<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box">
        {{mgs}}<button @click="reverseString">翻转</button> {{str}}
    </div>
    <script src="js/vue.js"></script>
    <script>
        let vm = new Vue({
            el: "#box",
            data: {
                mgs: "hello",
                str:""
            },
            methods: {
                reverseString() {
                    this.str = this.mgs.split("").reverse().join("")
                }
            }
        })
    </script>
</body>

</html>